package so.wy.servicecenter.businessbed.web.pay;

import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import so.wy.servicecenter.base.exception.ServiceException;
import so.wy.servicecenter.base.exception.WebException;
import so.wy.servicecenter.base.frame.web.AbstractWeb;
import so.wy.servicecenter.base.frame.web.webhand.WebExceptionHandler;
import so.wy.servicecenter.businessbed.service.pay.PayOptService;

@Service
@Scope("prototype")
public class PayOptWeb extends AbstractWeb {
    @Autowired
    private PayOptService payService;

    @WebExceptionHandler
    public void doWithDraw(Long rentUserId) throws WebException {
        try {
            payService.doWithDraw(rentUserId);
        } catch (ServiceException e) {
            throw exception(e);
        }
    }

    //押金充值
    @WebExceptionHandler
    public WxPayMpOrderResult yjczPre(Long userId) throws WebException {
        try {
            return payService.yjczPre(userId);
        } catch (ServiceException exception) {
            throw exception(exception);
        }
    }

    //押金体现
    @WebExceptionHandler
    public void yjtx(Long userId) throws WebException {
        try {
            payService.yjtx(userId);
        } catch (ServiceException exception) {
            throw exception(exception);
        }
    }
}
